package pkg

import (
	"encoding/json"
	"fmt"
	"github.com/Baidu-AIP/golang-sdk/aip/censor"
	"log"
	"yuekao3/config"
)

type Shen struct {
	Log_id         uint
	Error_code     uint
	Error_msg      string
	Conclusion     string
	ConclusionType uint
}

func BaiDu(wenzi string) bool {
	client := censor.NewClient(config.Conf.BaiDu.ApiKey, config.Conf.BaiDu.SecretKey)
	//如果是百度云ak sk,使用下面的客户端
	res := client.TextCensor(wenzi)
	fmt.Println(res)
	var req Shen
	json.Unmarshal([]byte(res), &req)
	log.Println(req)
	if req.ConclusionType != 1 {
		return false
	}
	return true
}
